{itemplate 'public/header'}
{itemplate 'common'}
<div class="clearfix">
	<div class="app-preview">
		<div class="app-header"></div>
		<div class="app-body">
			<div class="title">订单弹幕设置</div>
			<div class="main" id="app-preview"></div>
		</div>
		<div class="app-footer"></div>
	</div>
	<div class="app-editor form-horizontal" id="app-editor">
		<div class="editor-arrow"></div>
		<div class="inner"></div>
	</div>
</div>
<div class="app-action">
	<div class="action">
		<nav class="btn btn-default btn-sm pull-left" id="gotop">返回顶部</nav>
		<nav class="btn btn-primary btn-sm btn-save">保存并设置</nav>
	</div>
</div>
<script type="text/html" id="tpl-show-danmu">
	<style type="text/css">
		.order-danmu{top: 20px; background: <(css.background || '#000')>; opacity: <(css.opacity || '0.7')>;}
		.order-danmu .info{color: <(css.color)>;}
		.order-danmu .time{color: <(css.color)>;}
	</style>
	<div class="order-danmu <(if params.styleType == '2')>style2<(/if)>">
		<img class="thumb" src="../addons/we7_wmall/plugin/diypage/static/img/1.png" alt="">
		<span class="info">最新订单来自某某某</span>
		<span class="time">刚刚</span>
	</div>
</script>

<script type="text/html" id="tpl-editor-danmu">
	<div class="form-group">
		<div class="col-sm-2 control-label">是否启用</div>
		<div class="col-sm-10">
			<div class="radio radio-inline">
				<input type="radio" name="status" value="0" class="diy-bind" data-bind-child="params" data-bind="status" id="status-0" <(if params.status=='0')>checked<(/if)>>
				<label for="status-0">不启用</label>
			</div>
			<div class="radio radio-inline">
				<input type="radio" value="1" name="status" class="diy-bind" data-bind-child="params" data-bind="status" id="status-1" <(if params.status=='1')>checked<(/if)>>
				<label for="status-1">启用</label>
			</div>
		</div>
	</div>
	<div class="line"></div>
	<div class="form-group">
		<div class="col-sm-2 control-label">样式选择</div>
		<div class="col-sm-10">
			<div class="radio radio-inline">
				<input type="radio" value="1" name="styleType" class="diy-bind" data-bind-child="params" data-bind="styleType" id="style-type-0" <(if params.styleType=='1')>checked<(/if)>>
				<label for="style-type-0">样式一(椭圆)</label>
			</div>
			<div class="radio radio-inline">
				<input type="radio" value="2" name="styleType" class="diy-bind" data-bind-child="params" data-bind="styleType" id="style-type-1" <(if params.styleType=='2')>checked<(/if)>>
				<label for="style-type-1">样式二(圆角)</label>
			</div>
		</div>
	</div>
	<div class="form-group">
		<div class="col-sm-2 control-label">背景颜色</div>
		<div class="col-sm-4">
			<div class="input-group">
				<input class="form-control input-sm diy-bind color" type="color" data-bind-child="css" data-bind="background" value="<(css.background)>">
				<span class="input-group-addon btn btn-default" onclick="$(this).prev().val('#ff2d4b').trigger('propertychange')">重置</span>
			</div>
		</div>
	</div>
	<div class="form-group">
		<div class="col-sm-2 control-label">文字颜色</div>
		<div class="col-sm-4">
			<div class="input-group">
				<input class="form-control input-sm diy-bind color" type="color" data-bind-child="css" data-bind="color" value="<(css.color)>">
				<span class="input-group-addon btn btn-default" onclick="$(this).prev().val('#ffffff').trigger('propertychange')">重置</span>
			</div>
		</div>
	</div>
	<div class="form-group">
		<div class="col-sm-2 control-label">背景透明度</div>
		<div class="col-sm-10">
			<div class="form-group">
				<div class="slider col-sm-8" data-value="<(css.opacity)>" data-min="1" data-max="10" data-decimal="10"></div>
				<div class="col-sm-4 control-labe count"><span><(css.opacity)></span>(最大是1)</div>
				<input class="diy-bind input" data-bind-child="css" data-bind="opacity" value="<(css.opacity)>" type="hidden" />
			</div>
		</div>
	</div>
	<div class="line"></div>
	<div class="form-group">
		<div class="col-sm-2 control-label">点击链接</div>
		<div class="col-sm-10">
			<div class="input-group">
				<input class="form-control input-sm diy-bind" data-bind-child="params" data-bind="link" value="<(params.link)>" id="plink" placeholder="可选择链接或手动填写" />
				<span class="input-group-addon btn btn-default js-selectLink" data-input="#plink">选择链接</span>
			</div>
			<div class="help-block">提示：不填则不跳转</div>
		</div>
	</div>
	<div class="line"></div>

	<div class="form-group">
		<div class="col-sm-2 control-label">数据设置</div>
		<div class="col-sm-10">
			<div class="radio radio-inline">
				<input type="radio" value="0" name="dataType" class="diy-bind" data-bind-child="params" data-bind="dataType" data-bind-init="true" id="data-type-0" <(if params.dataType=='0')>checked<(/if)>>
				<label for="data-type-0">随机会员</label>
			</div>
			<div class="radio radio-inline">
				<input type="radio" value="1" name="dataType" class="diy-bind" data-bind-child="params" data-bind="dataType" data-bind-init="true" id="data-type-1" <(if params.dataType=='1')>checked<(/if)>>
				<label for="data-type-1">读取系统订单</label>
			</div>
<!--
			<div class="radio radio-inline">
				<input type="radio" value="2" name="dataType" class="diy-bind" data-bind-child="params" data-bind="dataType" data-bind-init="true" id="data-type-2" <(if params.dataType=='2')>checked<(/if)>>
				<label for="data-type-2">自定义数据</label>
			</div>
			<(if params.dataType=='2')>
				<div class="help-block">提示：自定义数据时下单时间可填"5秒前"、"5秒"或"5" 后两者系统将自动转换为前者</div>
			<(/if)>
-->
		</div>
	</div>

	<(if params.dataType=='0')>
		<div class="form-group">
			<div class="col-sm-2 control-label">随机时间(秒)</div>
			<div class="col-sm-10">
				<div class="input-group">
					<span class="input-group-addon">随机开始时间</span>
					<input class="form-control input-sm diy-bind" type="number" data-bind-child="params" data-bind="starttime" value="<(params.starttime)>">
					<span class="input-group-addon border-0-lr">随机结束时间</span>
					<input class="form-control input-sm diy-bind" type="number" data-bind-child="params" data-bind="endtime" value="<(params.endtime)>">
				</div>
				<div class="help-block">提示：将在以上区间随机显示(小于等于0为"刚刚"，大于60显示"x分钟")</div>
			</div>
		</div>
	<(/if)>
<!--
	<(if params.dataType=='2')>
		<div class="form-items" data-min="1" data-max="10">
			<div class="inner" id="form-items">
				<(each data as item index)>
					<div class="item" data-id="<(index)>">
						<span class="btn-del del-item" title="删除"></span>
						<div class="item-body">
							<div class="item-image">
								<img src="<(tomedia item.imgurl)>" id="cimg-<(index)>">
							</div>
							<div class="item-form">
								<div class="input-group">
									<input type="text" class="form-control input-sm diy-bind" value="<(item.imgurl)>" placeholder="请选择图片或输入图片地址" data-bind-parent="<(index)>" data-bind-child="data" data-bind="imgurl" id="pimg-<(index)>">
									<span class="input-group-addon btn btn-default js-selectImg" data-input="#pimg-<(index)>" data-element="#cimg-<(index)>">选择图片</span>
								</div>
								<div class="input-group">
									<span class="input-group-addon">昵称</span>
									<input class="form-control input-sm" value="<(item.nickname)>" data-bind="nickname" data-bind-parent="<(index)>" data-bind-child="data" placeholder="用户昵称">
									<span class="input-group-addon border-0-lr">下单时间</span>
									<input class="form-control input-sm" value="<(item.time)>"  data-bind="time" data-bind-parent="<(index)>" data-bind-child="data" placeholder="下单时间">
								</div>
							</div>
						</div>
					</div>
				<(/each)>
			</div>
			<div class="btn btn-default btn-block" id="addItem"><i class="icon icon-plus"></i> 添加一个</div>
		</div>
	<(/if)>
-->
</script>
<script language="javascript">
	var path = '../../plugin/diypage/static/js/diy.danmu';
	irequire([path, 'tmodtpl'],function(diyDanmu, tmodtpl){
		diyDanmu.init({
			tmodtpl: tmodtpl,
			attachurl: "{$_W['attachurl']}",
			danmu: {if !empty($config_danmu)}{php echo json_encode($config_danmu)}{else}null{/if}
		});
	});
</script>
{itemplate 'public/footer'}